import 'package:xreader/generated/json/base/json_convert_content.dart';
import 'package:xreader/model/t_book_entity.dart';
import 'package:xreader/model/t_book_cont_entity.dart';


TBookEntity $TBookEntityFromJson(Map<String, dynamic> json) {
	final TBookEntity tBookEntity = TBookEntity();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		tBookEntity.id = id;
	}
	final String? phk = jsonConvert.convert<String>(json['phk']);
	if (phk != null) {
		tBookEntity.phk = phk;
	}
	final String? bname = jsonConvert.convert<String>(json['bname']);
	if (bname != null) {
		tBookEntity.bname = bname;
	}
	final String? bauthor = jsonConvert.convert<String>(json['bauthor']);
	if (bauthor != null) {
		tBookEntity.bauthor = bauthor;
	}
	final String? bchao = jsonConvert.convert<String>(json['bchao']);
	if (bchao != null) {
		tBookEntity.bchao = bchao;
	}
	final int? bcount = jsonConvert.convert<int>(json['bcount']);
	if (bcount != null) {
		tBookEntity.bcount = bcount;
	}
	final int? bstatus = jsonConvert.convert<int>(json['bstatus']);
	if (bstatus != null) {
		tBookEntity.bstatus = bstatus;
	}
	final int? border = jsonConvert.convert<int>(json['border']);
	if (border != null) {
		tBookEntity.border = border;
	}
	final String? bsign = jsonConvert.convert<String>(json['bsign']);
	if (bsign != null) {
		tBookEntity.bsign = bsign;
	}
	final String? bdesc = jsonConvert.convert<String>(json['bdesc']);
	if (bdesc != null) {
		tBookEntity.bdesc = bdesc;
	}
	final int? tmsec = jsonConvert.convert<int>(json['tmsec']);
	if (tmsec != null) {
		tBookEntity.tmsec = tmsec;
	}
	final List<TBookContEntity>? chapters = jsonConvert.convertListNotNull<TBookContEntity>(json['chapters']);
	if (chapters != null) {
		tBookEntity.chapters = chapters;
	}
	return tBookEntity;
}

Map<String, dynamic> $TBookEntityToJson(TBookEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['phk'] = entity.phk;
	data['bname'] = entity.bname;
	data['bauthor'] = entity.bauthor;
	data['bchao'] = entity.bchao;
	data['bcount'] = entity.bcount;
	data['bstatus'] = entity.bstatus;
	data['border'] = entity.border;
	data['bsign'] = entity.bsign;
	data['bdesc'] = entity.bdesc;
	data['tmsec'] = entity.tmsec;
	data['chapters'] =  entity.chapters?.map((v) => v.toJson()).toList();
	return data;
}